import request from '../../utils/request'

/**
 * 新增利润
 *
 * @param profitForm
 * @param bindingResult
 * @return
 */
export async function createProfit( data ) {
    return request(apiPath.mc + "/api/profit", {
        method: 'post',
        data
    });
}


/**
 * 更新利润
 *
 * @param profitForm
 * @param bindingResult
 * @return
 */
export async function updateProfit( data ) {
    return request(apiPath.mc + "/api/profit", {
        method: 'put',
        data
    });
}

/**
 * 启用/停用利润
 *
 * @param profitForm
 * @param bindingResult
 * @return
 */
export async function updateProfitStatus( {id,status} ) {
    return request(apiPath.mc + "/api/profit/status", {
        method: 'put',
        data:{id,status}
    });
}

/**
 * 根据id删除利润
 *
 * @param id
 * @return
 */
export async function deleteProfitById({ id }){
    return request(apiPath.mc + "/api/profit/" + id,{
        method: 'delete'

    });
}

/**
 * 根据id获取利润
 *
 * @param id
 * @return
 */
export async function getProfitById({ id }){
    return request(apiPath.mc +  "/api/profit/" + id,{
        method: 'get'
    });
}

/**
 * 分页查询利润
 *
 * @param status
 * @param type
 * @param supplier
 * @param effective
 * @param page
 */
export async function getListForPage({status, type, supplier, effective, airlineCodeName, page}) {
    return request(apiPath.mc + "/api/profit", {
        method: 'get',
        data: {status, type, supplier, effective, airlineCodeName, page: page.page, size: page.size}
    });
}